package com.zs.propertymanage.controller;

import com.zs.propertymanage.dataObj.R;
import com.zs.propertymanage.service.impl.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/message")
@CrossOrigin
public class MessageController {

    @Autowired
    private MessageService messageService;

    /**
     * 根据接收者类型与id获取消息列表
     *
     * @param receiverType 接收者类型
     * @param receiverId   接收者id
     * @return 查询结果
     */
    @GetMapping("/{receiverType}/{receiverId}")
    public R getMessages(@PathVariable Integer receiverType, @PathVariable String receiverId) {
        return messageService.getMessages(receiverType, receiverId);
    }

}
